package com.example.day03_2_consumer.feign;

import com.example.day03_2_consumer.config.FeignConfig;
import com.example.day03_2_consumer.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient(value = "service",fallback =UserFeignImpl.class,configuration = FeignConfig.class)
//service代表serviceID,fallback定义降级方法所在的类(feign接口实现类)
//提示：feign不会把异常当做熔断条件
public interface UserFeign {
    //feign会通过动态代理的方式，帮我们实现该方法，内部还是使用restTemplate
    //restTemplate.getForObject(url,User.class);
    @RequestMapping("/serviceUser/{id}")
    User fbi(@PathVariable("id") Integer id);
}
